﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<BLL.DTO.Empresa.EmpresaDTO>>" %>

<% using (Html.BeginForm("ListarEmpresas_Submit", "Solicitud", FormMethod.Post, new { id = "formEmpresas" }))
   { %>
    <table class="grid" id="tblEmpresas">
        <tr>
            <th scope="col" style="width:3%;">&nbsp;</th>
            <th scope="col" style="width:37%;"><%: Html.DisplayNameFor(model => model.nombreFantasia_Empresa) %></th>
            <th scope="col" style="width:37%;"><%: Html.DisplayNameFor(model => model.direccion_Empresa) %></th>
            <th scope="col" style="width:17%;"><%: Html.DisplayNameFor(model => model.codigo_Comuna)%></th>
            <th scope="col" style="width:6%;"><%: Html.DisplayNameFor(model => model.calificacion_Empresa) %></th>
        </tr>
        <% if (Model.Count() == 0)
           { %>
            <tr class="emptyRow">
                <td colspan="100%">
                    <%: Resources.Presentation.ListarEmpresas.errorNoData %>
                </td>
           </tr>
        <% }
           else
           {
               bool alternate = false;
               foreach (var item in Model)
               {
                   alternate = !alternate;
                   string trClass = (alternate) ? "gridNoAlternateRow" : "gridAlternateRow"; %>
                    <tr class="<%: trClass %>">
                        <td class="gridCenteredColumn" style="width:3%">
                            <% var keyGrilla = item.rut_Empresa; %>
                            <input type="checkbox" name="SelectedItems" onchange="validarChecked(this)" value="<%: keyGrilla %>" />
                        </td>
                        <td style="width:37%;"><%: Html.DisplayFor(model => item.nombreFantasia_Empresa)%></td>
                        <td style="width:37%;"><%: Html.DisplayFor(model => item.direccionFinal)%></td>
                        <td style="width:17%;"><%: Html.DisplayFor(model => item.nombreComuna) %></td>
                        <td style="width:6%;"><%: Html.DisplayFor(model => item.calificacion_Empresa)%></td>
                    </tr>
            <% }
           } %>
    </table">
<% } %>